﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.CalculateControls;
using 纸片人.win2dEffectControl.DataClass;

// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public sealed class ColorReplacementEffectControl : EffectControl
    {

        private ColorPicker sourceColorPicker;
        private ColorPicker targetColorPicker;
        Button sourceButton;
        private TextBoxSlider thresholdTexBoxSlider;
        public override EffectOneSourceData OneEffetData { get; set; }
    
        public ColorReplacementEffectControl()
        {
            this.DefaultStyleKey = typeof(ColorReplacementEffectControl);
           
            OneEffetData = new ColorReplacementEffectData();
        }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            SetEffectName("颜色替换效果：", "ColorReplacementEffect");




            thresholdTexBoxSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(thresholdTexBoxSlider));
            SetTextBoxSlider(thresholdTexBoxSlider, OneEffetData, nameof(ColorReplacementEffectData.Threshold));

            sourceColorPicker = GetTemplateChildFormName<ColorPicker>(nameof(sourceColorPicker));
            SetColorPicker(sourceColorPicker, OneEffetData, nameof(ColorReplacementEffectData.SourceColor));

            targetColorPicker = GetTemplateChildFormName<ColorPicker>(nameof(targetColorPicker));
            SetColorPicker(targetColorPicker, OneEffetData, nameof(ColorReplacementEffectData.TargetColor));

          

        }


    }
}